<template>
  <div>
    {{cla}}
    <br>
    欢迎: {{names}} 小朋友 <br>
    你当前班级为:{{cla.gradeid.name}} <br>
    你选的课程有:
    <ul>
      <li v-for="i in cla.gradeid.classs">{{i.name}}</li>
    </ul>
    <p>
      <button @click="upgrade" v-if="cla.gradeid.type<3" >升班</button>
    </p>
  </div>
</template>

<script>
export default {
  name: "day105_stushow",
  data() {
    return {
      names:localStorage.getItem('name'),
      userid:localStorage.getItem('userid'),
      cla:[]
    }
  },
  methods: {
    get_clas(){
      this.$axios.get('teacher/sgcla/?id='+this.userid).then(res=>{
        this.cla =res.data.list
      })
    },
    upgrade(){
      this.$axios.post('teacher/sgcla/',{'id':this.userid}).then(res=>{
        this.get_clas()
      })
    }
  },
  mounted() {
    this.get_clas()
  }

}
</script>

<style scoped>

</style>
